using System.Collections;
using System.IO;
using UnityEngine;

namespace Assets.Scripts.GDK
{
	public class gdk_www_component : MonoBehaviour
	{
		public void startCoroutine(IEnumerator routine)
		{
			StartCoroutine(routine);
		}

		public TextAsset readResources(string fileName)
		{
			TextAsset textAsset = Resources.Load(fileName) as TextAsset;
			UnityEngine.Debug.Log("Resource:" + textAsset.text);
			return textAsset;
		}

		public void readStreamingAssets(string fileName)
		{
			string text = Path.Combine(Application.streamingAssetsPath, fileName);
			if (text.Contains("://"))
			{
				UnityEngine.Debug.Log("Android Path" + text);
				StartCoroutine(readMessage(text));
			}
			else
			{
				string str = File.ReadAllText(text);
				UnityEngine.Debug.Log("PC / ios Path：" + text);
				UnityEngine.Debug.Log("PC / ios StreamingAssets" + str);
			}
		}

		private IEnumerator readMessage(string path)
		{
			WWW www = new WWW(path);
			yield return www;
			UnityEngine.Debug.Log("Android StreamAssets:" + www.text);
			string text = www.text;
		}
	}
}
